package com.ftx.domain.vo;

import java.util.List;

/**
 * Created by fengtingxin on 2019/6/23.
 */
public class PageVO<T> {

    /**
     * 实际个数
     */
    private int totalCount;

    /**
     * 实际页数
     */
    private int totalPage;

    /**
     * 当前页数
     */
    private int currentPage;

    /**
     * 每页个数
     */
    private int pagesize;

    /**
     * list
     */
    private List<T> entity;

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage() {
        this.totalPage = this.totalCount % this.pagesize == 0 ? this.totalCount / this.pagesize : this.totalCount / this.pagesize + 1;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPagesize() {
        return pagesize;
    }

    public void setPagesize(int pagesize) {
        this.pagesize = pagesize;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getEntity() {
        return entity;
    }

    public void setEntity(List<T> entity) {
        this.entity = entity;
    }


    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("PageVO{");
        sb.append("totalCount=").append(totalCount);
        sb.append(", totalPage=").append(totalPage);
        sb.append(", currentPage=").append(currentPage);
        sb.append(", pagesize=").append(pagesize);
        sb.append(", entity=").append(entity);
        sb.append('}');
        return sb.toString();
    }
}
